#!/usr/bin/env lua

module("showdir", package.seeall)
local lfs = require("lfs")
local homepath = "/usr/local/moochine-demo/file/"
local t = {}
function main(req, resp,path)
	resp.headers['Content-Type'] = 'application/json'
	for file in lfs.dir(homepath .. path) do
		--resp:writeln(line)
		if file ~="." and file ~=".." then
			t = lfs.attributes(homepath .. path  ..  "/" .. file)
			
			resp:writeln(file .. "\t" .. "\t" .. t.mode)
		end
	end
end
